﻿Ext.define('Kwan.ex.SimpleCombo', {
    extend: 'Ext.form.field.ComboBox',
    alias: 'widget.Kwan.ex.SimpleCombo',
    emptyText: "请选择...",
    mode: 'local',
    queryMode: 'local',
    forceSelection: true,
    triggerAction: 'all',
    typeAhead: true,
    selectOnFocus: true,
    valueField: 'Value',
    displayField: 'Key',
    labelAlign: 'right',
    editable: false,
    initComponent: function () {
        var me = this, i = 0, ex_data = [];
        Ext.each(this.ds, function (val) {
            if (val.length>0)
                ex_data.push({ 'Key': val, 'Value': i });
            i++;
        });
        this.store = Ext.create('Ext.data.Store', {
            fields: ['Key', 'Value'],
            data: ex_data,
            autoLoad: true
        });
        this.store.load();
        this.callParent(arguments);
    }
});
